﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ASPNETPerformance.App_BusinessLogic.BasePages;
using ASPNETPerformance.App_BusinessLogic.Navigation;

namespace ASPNETPerformance.UserControls {
    public partial class SideMenu : BaseUserControl {
        private NavigationClass navigation;
        protected void Page_Load( object sender, EventArgs e ) {
            navigation = ( ( BasePage )Page ).Navigation;
            navigation.LoadSectionMenu( dsMenu1, rptSideMenu1 );
        }

        protected void RptSideMenu_ItemDataBound( object sender, RepeaterItemEventArgs e ) {
            Repeater rptSideMenu2 = ( Repeater )e.Item.FindControl( "rptSideMenu2" );
            SiteMapDataSource dsMenu2 = ( SiteMapDataSource )e.Item.FindControl( "dsMenu2" );
            if ( rptSideMenu2 != null ) {
                navigation.SetNodeSectionMenu( dsMenu2, ( SiteMapNode )e.Item.DataItem, rptSideMenu2 );
            }
        }
    }
}